]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
shell-global: Add shell_global_maybe_gc
authorAdel Gadllah <adel.gadllah@gmail.com>
Sat, 3 Apr 2010 10:48:18 +0000 (12:48 +0200)
committerAdel Gadllah <adel.gadllah@gmail.com>
Fri, 21 May 2010 21:47:25 +0000 (23:47 +0200)
Add a method to call JS_MaybeGC, see
https://developer.mozilla.org/en/SpiderMonkey/JSAPI_Reference/JS_MaybeGC

https://bugzilla.gnome.org/show_bug.cgi?id=614725

src/shell-global.c
src/shell-global.h

index 531ef2c4444e17bd07bd415e049feed6e1ae8667..11f0ee4b0191f3e1b69b44abae22c2118e65f87e 100644 (file)
@@ -841,6 +841,22 @@ shell_global_gc (ShellGlobal *global)
   JS_GC (context);
 }
 
+/**
+ * shell_global_maybe_gc:
+ * @global: A #ShellGlobal
+ *
+ * Start a garbage collection process when it would free up enough memory
+ * to be worth the amount of time it would take
+ * https://developer.mozilla.org/en/SpiderMonkey/JSAPI_Reference/JS_MaybeGC
+ */
+void
+shell_global_maybe_gc (ShellGlobal *global)
+{
+  JSContext *context = gjs_context_get_native_context (global->js_context);
+
+  JS_MaybeGC (context);
+}
+
 void
 shell_global_grab_dbus_service (ShellGlobal *global)
 {
index 480d47b56a908716aad92de797700b8e23b8d547..e46bea17bc8786c65e7631914d0e90628b67dd7e 100644 (file)
@@ -74,6 +74,8 @@ void shell_global_breakpoint (ShellGlobal *global);
 
 void shell_global_gc (ShellGlobal *global);
 
+void shell_global_maybe_gc (ShellGlobal *global);
+
 void shell_global_format_time_relative_pretty (ShellGlobal *global, guint delta, char **text, guint *update_time);
 
 ClutterActor *shell_global_create_root_pixmap_actor (ShellGlobal *global);